package com.chaopei.day06.entity;

import java.io.Serializable;

/**
 * @Author Corday 天涯
 * @Date 2022/3/10 15:32
 */
public class Tree implements Serializable {//如果进行网络传输则务必序列化
    private  String tname;
    private  Integer tage;
    private Double tval;
    public  Tree(){}

    public Tree(String tname, Integer tage, Double tval) {
        this.tname = tname;
        this.tage = tage;
        this.tval = tval;
    }

    public String getTname() {
        return tname;
    }

    public void setTname(String tname) {
        this.tname = tname;
    }

    public Integer getTage() {
        return tage;
    }

    public void setTage(Integer tage) {
        this.tage = tage;
    }

    public Double getTval() {
        return tval;
    }

    public void setTval(Double tval) {
        this.tval = tval;
    }

    @Override
    public String toString() {
        return this.tname+"-"+this.tage+"-"+this.tval;
    }
    //    重写hashCode与equals函数

    @Override
    public int hashCode() {
        return tage<<2+tname.hashCode()<<2;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof  Tree){
            Tree tree =(Tree) (obj);
            return true;
        }
        return false;
    }
}
